/*
 *  Copyright (c) 2023-2025 苏州棱镜七彩信息科技有限公司 (Suzhou PrismAurora Information Technology Co.,Ltd)
 *  sbom-generate is licensed under Mulan PSL v2.
 *  You can use this software according to the terms and conditions of the Mulan PSL v2.
 *  You may obtain a copy of Mulan PSL v2 at:
 *           http://license.coscl.org.cn/MulanPSL2
 *  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 *  See the Mulan PSL v2 for more details.
 * */
package com.ljqc.utils;

import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * @ClassName LogUtils
 * @Description
 * @Date 2025/3/19 14:05
 * @Version V1.0
 **/
public final class LogUtils {
    private LogUtils() {

    }

    public static void configureGlobalLevel(Level level) {
        // 获取根记录器（所有 Logger 的父节点）
        Logger rootLogger = Logger.getLogger("");

        // 设置根记录器的级别
        rootLogger.setLevel(level);

        // 遍历所有处理器（如 ConsoleHandler），并设置它们的级别
        for (Handler handler : rootLogger.getHandlers()) {
            handler.setLevel(level);
        }
    }
}
